* Generate Figure B.7 (Sensitivity with respect to no sample adjustments)
use "Empirics/AggregateData/Database/output/Database.dta", clear
cd "Empirics/AggregateData/Analysis"
set more off
graph drop _all
local GraphsByEpi=0

*. Where to store results
local outputfolder "output"

*. Set Window length
local windowstart=-4
local windowend=8

*. Minimum # years events need to be apart
local apart=4 // baseline

*. Create variables & Declare panel
qui do "Analysis_dofiles/CreateVars.do" `outputfolder'

*. Identify Large Devaluations
gen largeDevaluation = 1 if gER<=-0.20 & acceER<=-0.10 & gRER<=0

* Ensure events are X years apart, where X is given by `apart'
qui do "Analysis_dofiles/Apart.do" `apart' `outputfolder' `windowstart' `windowend' 

*. Extract list of events in the sample
qui do "Analysis_dofiles/ExtractList.do"

sort id year
*. Create more variables:
qui do "Analysis_dofiles/CreateMoreVars.do"

* Generate Figure B.7 and save
qui do "Analysis_dofiles/Produce_FB6.do" `outputfolder' `GraphsByEpi' `windowstart' `windowend'
graph export "../../../Output/FB7.pdf", replace

cd ../../..
